home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / wnos5src.zip / USOCK.H < prev    next >
Text File  |  1993-08-09  |  2KB  |  111 lines

  1. #ifndef    _USOCK_H
  2. #define    _USOCK_H
  3.  
  4. #ifndef    _MBUF_H
  5. #include "mbuf.h"
  6. #endif
  7.  
  8. #ifndef    _LZW_H
  9. #include "lzw.h"
  10. #endif
  11.  
  12. #ifndef _PROC_H
  13. #include "proc.h"
  14. #endif
  15.  
  16. #ifndef _TCP_H
  17. #include "tcp.h"
  18. #endif
  19.  
  20. #ifndef _UDP_H
  21. #include "udp.h"
  22. #endif
  23.  
  24. #ifndef _IP_H
  25. #include "ip.h"
  26. #endif
  27.  
  28. #ifndef _NETROM_H
  29. #include "netrom.h"
  30. #endif
  31. /*
  32. #ifndef _SOCKADDR_H
  33. #include "sockaddr.h"
  34. #endif
  35. */
  36.  
  37. struct loc {
  38.     struct usock *peer;
  39.     struct mbuf *q;
  40.     int hiwat;        /* Flow control point */
  41.     int flags;
  42. #define    LOC_SHUTDOWN    1
  43. };
  44. #define    NULLLOC    (struct loc *)0
  45.  
  46. #define    LOCDFLOW    5    /* dgram socket flow-control point, packets */
  47. #define    LOCSFLOW    2048    /* stream socket flow control point, bytes */
  48. #define    SOBUF        256    /* Size of buffer for usputc()/usprintf() */
  49. #define    SOCKBASE    128    /* Start of socket indexes */
  50.  
  51. union sp {
  52.         struct sockaddr *sa;
  53.         struct sockaddr_in *in;
  54.         struct sockaddr_ax *ax;
  55.         struct sockaddr_nr *nr;
  56.         char *p;
  57. };
  58.  
  59. union cb {
  60.     struct tcb *tcb;
  61.     struct ax25_cb *ax25;
  62.     struct udp_cb *udp;
  63.     struct raw_ip *rip;
  64.     struct raw_nr *rnr;
  65.     struct nr4cb *nr4;
  66.     struct loc *local;
  67.     char *p;
  68. };
  69.  
  70. /* User sockets */
  71. struct usock {
  72.     struct proc *owner;
  73.     int refcnt;
  74.     char noblock;
  75.     char type;
  76. #define    NOTUSED                0
  77. #define    TYPE_TCP            1
  78. #define    TYPE_UDP            2
  79. #define    TYPE_AX25I            3
  80. #define    TYPE_AX25UI            4
  81. #define TYPE_RAW            5
  82. #define TYPE_NETROML3        6
  83. #define TYPE_NETROML4        7
  84. #define    TYPE_LOCAL_STREAM    8
  85. #define    TYPE_LOCAL_DGRAM    9
  86.     int rdysock;
  87.     union cb cb;
  88.     char *name;
  89.     int namelen;
  90.     char *peername;
  91.     int peernamelen;
  92.     char errcodes[4];        /* Protocol-specific error codes */
  93.     struct mbuf *obuf;        /* Output buffer */
  94.     struct mbuf *ibuf;        /* Input buffer */
  95.     char eol[3];            /* Text mode end-of-line sequence, if any */
  96.     int flag;                /* Mode flags, defined in socket.h */
  97.     int flush;                /* Character to trigger flush, if any */
  98.     struct lzw *zout;        /* Pointer to compression structure */
  99.     struct lzw *zin;
  100. };
  101. #define    NULLUSOCK    ((struct usock *)0)
  102.  
  103. extern char Badsocket[];
  104. extern char *Socktypes[];
  105. extern struct usock *Usock;
  106. extern int Nusock;
  107.  
  108. struct usock *itop __ARGS((int s));
  109.  
  110. #endif /* _USOCK_H */
  111.